package com.lindroy.androidplayer.ui.adapter

import androidx.lifecycle.LifecycleOwner
import androidx.recyclerview.widget.DiffUtil
import com.lindroy.androidplayer.base.adapter.BasePagingAdapter
import com.lindroy.androidplayer.databinding.WxArticleItemBinding
import com.lindroy.androidplayer.logic.model.WXArticleResp
import com.lindroy.androidplayer.viewmodels.ArticleItemViewModel

/**
 * @author Lin
 * @date 2022/1/22
 * @function
 */
class WxArticleAdapter(owner: LifecycleOwner) :
    BasePagingAdapter<ArticleItemViewModel, WxArticleItemBinding>(owner,object :DiffUtil.ItemCallback<ArticleItemViewModel>(){
        override fun areItemsTheSame(oldItem: ArticleItemViewModel, newItem: ArticleItemViewModel) = oldItem.id == newItem.id

        override fun areContentsTheSame(oldItem: ArticleItemViewModel, newItem: ArticleItemViewModel): Boolean  = oldItem == newItem
    }) {

    override fun WxArticleItemBinding.onBindViewHolder(item: ArticleItemViewModel?, position: Int) {
        vm = item
    }
}